# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Paul Boyd <boyd.paul2@gmail.com>

pkgname=amfora
pkgver=1.9.2
pkgrel=4
pkgdesc='Terminal browser for the Gemini protocol'
arch=(loong64 x86_64)
url='https://github.com/makeworld-the-better-one/amfora'
license=(GPL3)
makedepends=(git go)
source=('https://roboticoverlords.org/amfora.png'
        "git+$url#commit=61d864540140f463a183e187e4211c258bd518bf") # tag: v1.9.2
b2sums=('1f93ca564c2ef8ef9a94102ac50781b740266a2413cb92ac900240c9324d2dee27a19e4b0a95f45edf933e07ed133f696b4f969e3cfa7cb26a57bfdc63a287cb'
        'SKIP')
options=('!lto')

prepare() {
  echo Icon=amfora >> amfora/amfora.desktop
}

build() {
  cd amfora
  go build -buildmode=pie -mod=readonly -modcacherw -trimpath -ldflags \
    "-s -w -linkmode=external -extldflags $LDFLAGS -X main.version=$pkgver -X main.builtBy=Arch_Linux -X main.commit=${source#*=}"
}

package() {
  install -Dm644 amfora.png "$pkgdir/usr/share/pixmaps/amfora.png"
  install -Dm755 amfora/amfora "$pkgdir/usr/bin/amfora"
  install -Dm644 amfora/amfora.desktop "$pkgdir/usr/share/applications/amfora.desktop"
}
